<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>全局对象</title>
    <link
      href="https://cdn.bootcss.com/twitter-bootstrap/4.4.1/css/bootstrap.css"
      rel="stylesheet"
    />
    <link
      href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css"
      rel="stylesheet"
    />
    <link
      href="https://cdn.bootcss.com/animate.css/3.7.2/animate.min.css"
      rel="stylesheet"
    />
  </head>
  <body>
    <header>
      <h1 class="text-center">js/ECMAScript/DOM/BOM</h1>
      <h2 class="text-center">happy-today</h2>
    </header>
    <main></main>
    <footer></footer>
    <script src="https://cdn.bootcss.com/vue/2.6.11/vue.js"></script>
    <script>
      // window直接输入内容来输出内容
      console.log(window, document, location);
      // console.log(window, document, lastModified);
      // var results = document.getElementsByTagName("h1");
      // for (const key in results) {
      //   console.log(key);
      // }
      var r1se = document.getElementsByTagName("h2");
      for (var key in r1se) {
        console.log(key);
      }
      r1se[0].innerText = "hellow-world";
      r1se[0].className = "text-warning";
      // var myItem = document.getElementById("active");
      // console.log(myItem.parentNode.tagName);
      // console.log(myItem.getAttribute("title"));
      // myItem.setAttribute("title", "主要用以和用户交互");
      // console.log(myItem.getAttribute("title"));

      // 生成一个段落，里面包含内容
      var oP = document.createElement("p");
      var oText = document.createTextNode("这是一个使用 DOM 生成的段落");
      oP.appendChild(oText);
      document.body.appendChild(oP);

      var a = (b = 1);
      console.time("timer");
      for (var i = 0; i < 10000; i++) {}
      console.assert(a === 1, "这时候条件是a==1,实际a是1");
      console.assert(b === 1, "这时候条件是b==1，实际b是2"); //断言你要干什么什么
      console.warn("这是一段警告信息"); //警告信息
      console.error("出错啦，你的配置信息有误");
      console.timeEnd("timer");
    </script>
  </body>
</html>
